import { own_getDay } from './time'


export const AREA_CODES = [
  {
    "code": "10000",
    "name": "全国",
    "active": false
  },
  {
    "code": "110000",
    "name": "北京",
    "active": false
  },
  {
    "code": "320000",
    "name": "江苏",
    "active": false

  },
  {
    "code": "330000",
    "name": "浙江",
    "active": false
  },
  {
    "code": "340000",
    "name": "安徽",
    "active": false
  },
  {
    "code": "350000",
    "name": "福建",
    "active": false
  },
  {
    "code": "360000",
    "name": "江西",
    "active": false
  },
  {
    "code": "370000",
    "name": "山东",
    "active": false
  },
  {
    "code": "410000",
    "name": "河南",
    "active": false
  },
  {
    "code": "420000",
    "name": "湖北",
    "active": false
  },
  {
    "code": "430000",
    "name": "湖南",
    "active": false
  },
  {
    "code": "440000",
    "name": "广东",
    "active": false
  },
  {
    "code": "120000",
    "name": "天津",
    "active": false
  },
  {
    "code": "450000",
    "name": "广西",
    "active": false
  },
  {
    "code": "460000",
    "name": "海南",
    "active": false
  },
  {
    "code": "500000",
    "name": "重庆",
    "active": false
  },
  {
    "code": "510000",
    "name": "四川",
    "active": false
  },
  {
    "code": "520000",
    "name": "贵州",
    "active": false
  },
  {
    "code": "530000",
    "name": "云南",
    "active": false
  },
  {
    "code": "540000",
    "name": "西藏",
    "active": false
  },
  {
    "code": "610000",
    "name": "陕西",
    "active": false
  },
  {
    "code": "620000",
    "name": "甘肃",
    "active": false
  },
  {
    "code": "630000",
    "name": "青海",
    "active": false
  },
  {
    "code": "130000",
    "name": "河北",
    "active": false
  },
  {
    "code": "640000",
    "name": "宁夏",
    "active": false
  },
  {
    "code": "650000",
    "name": "新疆",
    "active": false
  },
  {
    "code": "710000",
    "name": "台湾",
    "active": false
  },
  {
    "code": "810000",
    "name": "香港",
    "active": false
  },
  {
    "code": "820000",
    "name": "澳门",
    "active": false
  },
  {
    "code": "140000",
    "name": "山西",
    "active": false
  },
  {
    "code": "150000",
    "name": "内蒙古",
    "active": false
  },
  {
    "code": "210000",
    "name": "辽宁",
    "active": false
  },
  {
    "code": "220000",
    "name": "吉林",
    "active": false
  },
  {
    "code": "230000",
    "name": "黑龙江",
    "active": false
  },
  {
    "code": "310000",
    "name": "上海",
    "active": false
  }
]


export const TIME_LIST_SELECT =
  [
    {
      name: '不限',
      active: true
    },
    {
      name: '今天',
      active: false
    },
    {
      name: '近7天',
      active: false
    },
    {
      name: '近1个月',
      active: false
    },
    {
      name: '一个月前',
      active: false
    }
  ]



export const AREA_CODES_NAME = [
  {
    areaName: '全国',
    province: [{
      name: '全国',
      code: '10000',
      active: false
    }],
  },
  {
    areaName: '华北地区',
    province: [
      {
        name: '北京',
        code: '110000',
        active: false
      },
      {
        name: '天津',
        code: '120000',
        active: false

      },
      {
        name: '河北',
        code: '130000',
        active: false
      },
      {
        name: '山西',
        code: '140000',
        active: false
      },
      {
        name: '内蒙古',
        code: '150000',
        active: false
      },
    ],
  },
  {
    areaName: '华南地区',
    province: [
      {
        name: '广东',
        code: '440000',
        active: false
      },
      {
        name: '广西',
        code: '450000',
        active: false
      },
      {
        name: '福建',
        code: '350000',
        active: false
      },
      {
        name: '海南',
        code: '460000',
        active: false
      },
    ],
  },
  {
    areaName: '华东地区',
    province: [
      {
        name: '上海',
        code: '310000',
        active: false
      },
      {
        name: '江苏',
        code: '320000',
        active: false
      },
      {
        name: '浙江',
        code: '330000',
        active: false
      },
      {
        name: '山东',
        code: '370000',
        active: false
      },
      {
        name: '安徽',
        code: '340000',
        active: false
      },
    ],
  },
  {
    areaName: '华中地区',
    province: [
      {
        name: '湖北',
        code: '420000',
        active: false
      },
      {
        name: '湖南',
        code: '430000',
        active: false
      },
      {
        name: '河南',
        code: '410000',
        active: false
      },
      {
        name: '江西',
        code: '360000',
        active: false
      },
    ],
  },
  {
    areaName: '西北地区',
    province: [
      {
        name: '陕西',
        code: '610000',
        active: false
      },
      {
        name: '甘肃',
        code: '620000',
        active: false
      },
      {
        name: '新疆',
        code: '650000',
        active: false
      },
      {
        name: '青海',
        code: '630000',
        active: false
      },
      {
        name: '宁夏',
        code: '640000',
        active: false
      },
    ],
  },
  {
    areaName: '西南地区',
    province: [
      {
        name: '四川',
        code: '510000',
        active: false
      },
      {
        name: '重庆',
        code: '500000',
        active: false
      },
      {
        name: '贵州',
        code: '520000',
        active: false
      },
      {
        name: '云南',
        code: '530000',
        active: false
      },
      {
        name: '西藏',
        code: '540000',
        active: false
      },
    ],
  },
  {
    areaName: '东北地区',
    province: [
      {
        name: '黑龙江',
        code: '230000',
        active: false
      },
      {
        name: '吉林',
        code: '220000',
        active: false

      },
      {
        name: '辽宁',
        code: '210000',
        active: false
      }
    ]
  },
]

// 招投标类型对应颜色
export const TYPE_COLOR = [
  '#ff953f',
  '#3d9cfa',
  '#0bcad4',
  '#3fb5aa',
  '#ffc52a',
  '#ffc52a',
  '#8ea6b3']

/**
 * 
 * @param {*Object}  _this 从vue传递过来的组件实例
 * @param {*String}  dictType 传递的具体获取字典类型的 key
 */
// 数据字典获取通用方法
export const getDictList = async (_this, dictType) => {
  try {
    const res = await _this.$u.get('/dict', {
      dictType
    })
    const { code, data } = res
    if (code === 200) {
      return data
    }
  } catch (err) {
    console.log('err ===>', err)
  }
}









export const own_switchDict = (dictList, val) => {
  let v = ''
  dictList.forEach(item => {
    if (item.value === val || item.code === val) {
      v = item.name
    }
  })
  return v
}




export { own_getDay }